﻿Imports System.Drawing.Drawing2D
Imports System.Drawing
Imports ajayumi.develop.VBasic.Controls.Forms.Events

Namespace Forms.Renders
    Public Class ImageFlatRectangleRender
        Inherits FlatRectangleRender

        Protected Overrides Sub DrawCaptionBackground(ByVal g As System.Drawing.Graphics, ByVal captionRect As System.Drawing.Rectangle, ByVal active As Boolean)
            Dim _Color As Color = CType(IIf(active, Color.Yellow, Color.YellowGreen), Color)
            Using _OptimizeGraphics As New OptimizeGraphics(g)

                Using _Image As Image = Image.FromFile("D:\Caption_bg.png")
                    g.DrawImage(_Image, captionRect)
                End Using

                'g.DrawImage(
                'Using _Brush As New SolidBrush(_Color)
                '    'Using _GraphicsPath As GraphicsPath = GraphicsPathHelper.CreateFlatRectanglePath(captionRect, Me.Factor, CornerStyle.Top)

                '    Using _GraphicsPath As New GraphicsPath()
                '        _GraphicsPath.AddRectangle(captionRect)
                '        g.FillPath(_Brush, _GraphicsPath)
                '    End Using

                '    'End Using
                'End Using
            End Using
        End Sub

        Protected Overrides Sub DrawIcon(ByVal g As System.Drawing.Graphics, ByVal iconRectangle As System.Drawing.Rectangle, ByVal icon As System.Drawing.Icon)
            MyBase.DrawIcon(g, iconRectangle, icon)
        End Sub

        Protected Overrides Sub DrawCaptionText(ByVal g As System.Drawing.Graphics, ByVal textRectangle As System.Drawing.Rectangle, ByVal text As String, ByVal font As System.Drawing.Font)
            MyBase.DrawCaptionText(g, textRectangle, text, font)
        End Sub

        Protected Overrides Sub OnControlBoxRender(ByVal e As ControlBoxRenderEventArgs)
            'MyBase.OnControlBoxRender(e)
        End Sub
    End Class
End Namespace

